<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id='app'>
        {{msg}}
    </div>
    <script src="./vue.js"></script>
    <script>
        const myMixin = {
            data(){
                return {
                    msg:"123"
                }
            },
            created(){
                this.sayHello();
            },
            methods: {
                sayHello() {
                    console.log('hello mixin');
                }
            },
        }
        // mixin来分发Vue组件中的可复用功能

        new Vue({
            el:"#app",
            data:{
                msg:"小马哥"
            },
            created(){
                console.log(1111);
                
            },
            mixins:[myMixin]
        })
    
    </script>
    
</body>
</html>